package com.foogui.primary.queue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class BlockingQueueDemo {
    public static void main(String[] args) {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(3);

        queue.add("A");
        queue.add("B");
        queue.add("C");
        //返回值是阻塞队列的头，没有值就会抛出异常NoSuchElementException
        System.out.println(queue.element());
        System.out.println(queue.remove());
    }
}
